package com.zggk.iroad.db;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.List;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import com.zggk.iroad.greendao.DaoSession;
import com.zggk.iroad.greendao.BhLxInfoDao;
import com.zggk.iroad.greendao.BhInfoDao;

@Entity(nameInDb = "t_bh")
public class BhInfo {
    @Property(nameInDb = "id")//通过@Property()这个注解定义我外部数据库的字段名才能解决
    @Id(autoincrement = true)
    private Long id;
    private String CATEGORYCODE;//类型名称
    @ToMany(referencedJoinProperty = "parentId")
    private List<BhLxInfo> BHLX;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 1881233471)
    private transient BhInfoDao myDao;
    @Generated(hash = 950337756)
    public BhInfo(Long id, String CATEGORYCODE) {
        this.id = id;
        this.CATEGORYCODE = CATEGORYCODE;
    }
    @Generated(hash = 1928764080)
    public BhInfo() {
    }
    public Long getId() {
        return this.id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getCATEGORYCODE() {
        return this.CATEGORYCODE;
    }
    public void setCATEGORYCODE(String CATEGORYCODE) {
        this.CATEGORYCODE = CATEGORYCODE;
    }
    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 406837386)
    public List<BhLxInfo> getBHLX() {
        if (BHLX == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            BhLxInfoDao targetDao = daoSession.getBhLxInfoDao();
            List<BhLxInfo> BHLXNew = targetDao._queryBhInfo_BHLX(id);
            synchronized (this) {
                if (BHLX == null) {
                    BHLX = BHLXNew;
                }
            }
        }
        return BHLX;
    }
    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1263562125)
    public synchronized void resetBHLX() {
        BHLX = null;
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1508514450)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getBhInfoDao() : null;
    }
}
